SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


create procedure dbo.DnnProduct_IsUserInRole
    
@UserID        int,
@RoleId        int,
@PortalID      int

as

select dbo.DnnProduct_UserRoles.UserId,
       dbo.DnnProduct_UserRoles.RoleId
from dbo.DnnProduct_UserRoles
inner join dbo.DnnProduct_Roles on dbo.DnnProduct_UserRoles.RoleId = dbo.DnnProduct_Roles.RoleId
where  dbo.DnnProduct_UserRoles.UserId = @UserID
and    dbo.DnnProduct_UserRoles.RoleId = @RoleId
and    dbo.DnnProduct_Roles.PortalId = @PortalID
and    (dbo.DnnProduct_UserRoles.ExpiryDate >= getdate() or dbo.DnnProduct_UserRoles.ExpiryDate is null)










GO
